@extends('layouts.master3')
@section("title")
    评测结果
@endsection
@section("style")
    <style>
        .table a{color:blue;}
		.table a:hover{color:red;}
        .table thead{
            background: #DDDDDD;
        }
        .table thead tr th,
        .table tbody tr,
        .table tbody tr th,
		.contain h1{
            text-align: center;
        }
		.table tbody tr:first-child {
   			 background: #f6f6f6;
		}		
		.table a.red{
            color:red!important;
        }
        .table a.blue{
            color:blue;
        }
        .table a.green{
            color:green;
		}
		a.user{
			display:inline-block;
			width:80px;
		}
    </style>
@endsection
@section("content")
    <!-- Bootstrap FAQ - END -->
    <div class="contain" style="width:1200px;">
		<h1>Realtime Status</h1>
		<a font="red">为了安全性等问题，题目的样例和描述已经做了更改，提交前请仔细查看最新的样例。</a>
        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <th>Run ID</th>
                <th>User</th>
                <th>Problem</th>
                <th>Result</th>
                <th>Time</th>
                <th>Data</th>
                <th>Code Length</th>
                <th>totalcost</th>
            </tr>
            </thead>
            <tbody>

<?php
use App\Utils;
?>
@foreach($list as $l)
<?php 
if($l->status==1)
$data=json_decode($l->judge_info,true);
?>
            <tr>
                <th>{{$l->id}}</th>
                <td><a href="/judge/status?name={{$l->user->name}}" class="overhidden user" >{{$l->user->name}}</a></td>
                <td><a href="/contests/detail">赛码会-2</a></td>
				<td ><a class="<?php if($l->status==1&&$data['result']=="Accepted")echo "blue";else echo "red";?>" href="/judge/detail/{{$l->id}}"><?php if($l->status==0) echo "Waiting";else if($l->status==1){if($data['result']=="Wrong Answer")echo "WA";else echo $data['result'];} else if($l->status==2)echo "Judging";?></a></td>
				<td><?php if($l->status!=1) echo "-";else if($data['result']=="Accepted")echo intval($data['timeused'])."ms";else echo "-";?></td>
                <td>{{$l->datatype}}</td>
                <td>{{strlen($l->code)}}B</td>
				<td><?php if($l->status!=1) echo "-";else if($data['result']=="Accepted")echo $data['total_cost'];else echo "-";?></td>
            </tr>
@endforeach
            </tbody>
        </table>
    </div>
<div style="text-align:center">
<?php if(isset($name))echo $list->appends(['name'=>$name])->render();else echo $list->render();?>
</div>


    <div style="height:60px;"></div>
</div>
@stop
